<!-- 列表 -->
<extend name="Public:layout" />
<block name="title"><{$authName}></block>

<block name="pluginCSS">
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Admin/plugins/select2/select2.css"/>
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Admin/plugins/select2/select2-metronic.css"/>

<link rel="stylesheet" type="text/css" href="__PUBLIC__/Admin/plugins/bootstrap-fileinput/bootstrap-fileinput.css"/>
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Admin/plugins/bootstrap-timepicker/css/bootstrap-timepicker.min.css"/>
</block>
<block name="CSS"></block>

<block name="loadJS">
<script src="__PUBLIC__/Admin/plugins/bootstrap-fileinput/bootstrap-fileinput.js"></script>
<script type="text/javascript" src="__PUBLIC__/Admin/plugins/select2/select2.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/Admin/plugins/bootstrap-timepicker/js/bootstrap-timepicker.min.js"></script>
<script src="__PUBLIC__/admin/scripts/layer/layer.js" type="text/javascript"></script>	
<script src="__PUBLIC__/admin/plugins/jquery-validation/dist/jquery.validate.min.js" type="text/javascript"></script>


</block>
<block name="setJS">
<script src="__PUBLIC__/Admin/scripts/custom/validateShops.js"></script>
<script>
var ajaxUrl="<{:U('index')}>";


function callback(message,status)  {  
	if(status==1)  {  
		layer.msg(message, 
			{icon: 1,time: 2000},
			function(){
				location.href=ajaxUrl;
			}
		);   
	}  else{  
		layer.msg(message, 
			{icon: 2,time: 2000}
		);   
		
	}  
}  
</script>
</block>
<block name="initJS">

//ValidateShops.init();
</block>

<block name="pagetitle">增删改查</block>
<block name="page">

<div class="row">
	<div class="col-md-12">

		<div class="portlet">
			<div class="portlet-title">
				<div class="caption">
					<i class="fa <{$authIco}>"></i><{$authName}>
				</div>				
				<div class="actions">
					<a class="btn default green-stripe" id="table_manager_new" data-toggle="modal" href="javascript:history.back()">
						<i class="fa fa-reply"></i>
						<span class="hidden-480">返回</span>
					</a>
				</div>				
			</div>
			<div class="portlet-body">				
				<form class="form-horizontal" action="<{:U('index')}>" method="post" target="ajax" enctype="multipart/form-data">
				<iframe style="display:none" name='ajax' id="ajax" ></iframe>
				<input type="hidden" name="noAjax" value="editBrands">
				<input type="hidden" name="brandId" id="brandId"  value="<{$brands.brandId}>" />
				
				<div class="form-body">
					<div class="col-sm-6">
						<div class="form-group">
							<label class="col-sm-4 control-label" for="brandName">品牌名称</label>
							<div class="col-md-8">
								<input type="text" class="form-control" placeholder="品牌名称" name="brandName" id="brandName"  value="<{$brands.brandName}>" />
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-4 control-label" for="brandDesc">品牌简介</label>
							<div class="col-md-8">
								<textarea class="form-control" rows="3" placeholder="品牌简介" name="brandDesc" id="brandDesc"  value="" ><{$brands.brandDesc}></textarea>
							</div>
						</div>
						<div class="form-group">
							<label class="col-md-4 control-label">所属分类</label>
							<div class="col-md-8">
								<div class="checkbox-list">
									<foreach name="catName1" item="val" key="key" >
									<label class="checkbox">
									<php>if(in_array($val['catId'],$catIds)):</php>
									<!-- <span class="checked"> -->
									<input type="checkbox" name="catId[]" id="inlineCheckbox<{$val['catId']}>" value="<{$val['catId']}>" checked="true"/>
									<!-- </span> -->
									<php>else:</php>
									<input type="checkbox" name="catId[]" id="inlineCheckbox<{$val['catId']}>" value="<{$val['catId']}>" >
									<php>endif;</php>
									<{$val['catName']}></label>

									</foreach>
								</div>
							</div>
						</div>
						
					</div>

					<div class="col-sm-6">
						<div class="form-group">
							<label>品牌Logo</label>
							<div>
								<div class="fileinput fileinput-new" data-provides="fileinput">
									<div class="fileinput-new thumbnail" style="width: 200px; height: 150px;">
										<php>if(!empty($brands['brandIco'])):</php>
										<img src="__UPLOAD__/<{$brands['brandIco']|str_replace='.','_m.',###}>"/>
										<php>else:</php>
										<img src="http://www.placehold.it/200x150/EFEFEF/AAAAAA&amp;text=暂无LOGO" alt=""/>
										<php>endif;</php>
									</div>
									<div class="fileinput-preview fileinput-exists thumbnail" style="max-width: 200px; max-height: 150px;">
									</div>
									<div>
										<span class="btn default btn-file">
											<span class="fileinput-new">
												 选择图片
											</span>
											<span class="fileinput-exists">
												 更改图片
											</span>
											<input type="file" name="brandIco" id="brandIco">
										</span>
										<a href="#" class="btn default fileinput-exists" data-dismiss="fileinput">
											 删除图片
										</a>
									</div>
								</div>
							</div>
						</div>		
					</div>
				</div>		
				<div class="form-group fluid">
	                <div class="col-md-offset-2 col-md-9">
	                  <button type="submit" class="btn blue">保存</button>
	                  <button type="reset" class="btn default">取消</button>
	                </div>
              	</div>
				</form>
			</div>
		</div>
	</div>
</div>

</block>